import request from '../utils/request'

export function requestToRegister (params) {
    return new Promise(resolve => {
        request.post('/user/regist', params).then(res => {
            resolve(res.data)
        })
    })
}

export function requestToLogin (params) {
    return new Promise(resolve => {
        request.post('/user/login', params).then(res => {
            resolve(res)
        })
    })
}

export function requestPostUserBack (msg) {
    return new Promise(resolve => {
        request.post('/message/feedback', {
            userid: localStorage.getItem('userid') || '',
            msg
        }).then(res=>{
            resolve(res.data)
        })
    })
}

export function requestModifyUserPassword(password){
    return new Promise(resolve => {
        request.post('/user/modify',{
            userid:localStorage.getItem('userid'),
            password
        }).then(res=>{
            resolve(res.data)
        })
    })
}
